/*
 * ps_test.cpp
 *
 *  Created on: 2011-5-22
 *      Author: chenl
 */

#include "processmgt.h"
#include "task_wrapper.h"
#include "global.h"

void AddTasks(unsigned n)
{
	CProcessMgt& processMgt = GET_PROCESSMGT_INSTANCE();
	for (unsigned i = 0; i < n; ++i)
	{
		CTask* pCurrentTask = processMgt.CurrentTask();
		assert(NULL != pCurrentTask);
		CTask* pNewTask = NULL;
		pCurrentTask->NewTask(&pNewTask);
		assert (NULL != pNewTask);
		pNewTask->task.nice = i << 1;
		pNewTask->task.prio = pNewTask->task.static_prio = 101 + (i << 1);
		processMgt.InsertToRunQueue(*pNewTask);
//		pCurrentTask->NewTask(&pNewTask);
//		assert (NULL != pNewTask);
//		pNewTask->task.nice = i << 1;
//		pNewTask->task.prio = pNewTask->task.static_prio = 101 + (i << 1);
//		processMgt.InsertToRunQueue(*pNewTask);
	}
}
